**************************************
*                                    *
*   Roll Call Analysis Master Script *
*                                    *
**************************************

** Open "Roll Call Data.dta"

** Roll Call Analysis

* Figure 2
twoway (kdensity conop if mc_republican==0) (kdensity conop if mc_republican==1), xlab(0(.25)1) ytitle("Kernel Density") xtitle("Conservative Opinion") name(op_kdens) scheme(plotplain)
twoway (kdensity s_conservative if mc_republican==0) (kdensity s_conservative if mc_republican==1), xlab(0(.25)1) ytitle("Kernel Density") xtitle("Conservative Symbolic Identity") name(sym_kdens) scheme(plotplain)
grc1leg op_kdens sym_kdens, col(1) 

* Figure 3
graph bar congruentvote symcon, over(mc_republican) scheme(plotplain) blabel(total) ytitle("Proportion") ylab(0(.1).8)

** Roll Call Models **

* Table 2 Analysis
* Model 1
logit convote conop s_conservative mc_republican pct_ba, cluster(distid)
eststo m1_1
* Model 2
logit convote conop s_conservative pct_ba if mc_republican==0, cluster(distid)
eststo m1_2
* Model 3
logit convote conop s_conservative pct_ba if mc_republican==1, cluster(distid)
eststo m1_3

* Table 2: Logit Models of Roll Call Votes
estout m1_1 m1_2 m1_3 , cells(b(star fmt(3)) se(par fmt(3))) starlevels(** .05) stats(N chi2) 

* Comparing Coefficients for Democrats and Republicans
** These tests are the basis for our claims that there are statistically significant differences between the coefficients for Democrats and Republicans.
logit convote conop s_conservative pct_ba if mc_republican==0
eststo m1_2
logit convote conop s_conservative pct_ba if mc_republican==1
eststo m1_3
suest m1_2 m1_3, cluster(distid)
test [m1_2_convote]conop = [m1_3_convote]conop // chi2 = 46.53, p-value < 0.0001
test [m1_2_convote]s_conservative = [m1_3_convote]s_conservative // chi2 = 13.71, p-value = 0.0002



